package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * 增加商家分享数
 * fx
 */
public class DishAddTask extends CouponHttpBaseTask {
    private String mdishLogo;
    private String mPrice;
    private String mDishName;
    private String mDesc;
    public DishAddTask(String dishBigLogo,String price,String dishName,String dDescription) {
        super(TaskType.DISHADD_TASK);
        mdishLogo = dishBigLogo;
        mPrice = price;
        mDishName = dishName;
        mDesc = dDescription;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, null);
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest(RequestType.DISHADD_REQUEST);
            JSONObject json = new JSONObject();
            json.put("dishBigLogo", mdishLogo);
            json.put("price",mPrice);
            json.put("dishName",mDishName);
            json.put("dDescription",mDesc);
            request.setData(json.toString());
            request.setApiNo(ApiNo.DISHADD);
            addRequest(request);
        }
    }


}
